<div class="g12 nodrop" style="margin-bottom: 43px;">

    <h1> <? if (isset($user)) {echo 'Ažuriranje korisnika'; } else echo 'Novi korisnik' ?> </h1>

    <p style="line-height: 13px;">

        KORISNICI

    </p>


    <!--FORM IMAGE-->    
    <div style="width: 100%;">

        <div id="srvrserror-3"></div>

        <button id="dialog_confirm" style="display: none;">Confirm Dialog (confirm)</button>

        <form action="javascript:" method="post" autocomplete="off" data-confirm-send="false" id="frm_user">

            <fieldset>

                <section><label for="input">Ime:</label>
                    <div><input type="text" id="firstname" name="firstname" required value="<? if (isset($user)) echo $user[0]['firstname']; ?>"></div>
                </section>

                <section><label for="input">Prezime:</label>
                    <div><input type="text" id="lastname" name="lastname" required value="<? if (isset($user)) echo $user[0]['lastname']; ?>"></div>
                </section>

                <section><label for="input">Email:</label>
                    <div><input type="text" id="email" name="email" required value="<? if (isset($user)) echo $user[0]['email']; ?>"></div>
                </section>

                <? if (isset($user)){?>
                    <section><label for="input">Lozinka:</label>
                        <div><a href="javascript:" id="reset_pass">Resetuj lozinku</a><span style="color: 666;"> (Default: 123456)</span></div>
                    </section>
                    <?}else{?>
                    <section><label for="input">Lozinka:</label>
                        <div><input type="text" id="password_one" name="password_one" required value=""></div>
                    </section>

                    <section><label for="input">Lozinka ponovo:</label>
                        <div><input type="text" id="password_two" name="password_two" required value=""></div>
                    </section>
                    <?}?>



                <section><label for="input">Tip korisnika: <? echo set_value('typeofuser'); ?></label>
                    <div>

                        <table>
                            <thead>
                                <td>Tip korisnika:</td>
                                <td colspan="2" style="text-align: center;">Korisničke dozvole</td>
                            </thead>
                            <tbody>
                            <tr>
                                <td>
                                    <select name="typeofuser" id="typeofuser">
                                        <option value="0">-- Odaberite</option>
                                        <?
                                            foreach($typeofuser as $row){
                                            ?><option value="<?=$row['id']?>" <? if(isset($user)) if($row['id']== $user[0]['typeofuser_id'])echo 'selected="selected"'; ?>><?=$row['description']?></option><?
                                            }
                                        ?>

                                    </select>
                                </td>
                                <td>
                                    <ul>
                                        <li>AD Administrator - Sve privilegije</li>
                                        <li>ED Urednik  - Sve privilegije bez korisnika</li>
                                        <li>JN Novinar - Adminitrita svoje članke i medije</li>
                                    </ul>
                                </td>
                                <td>
                                    <ul>
                                        <li>LT Lektor - Pregled i izmjena svih članaka</li>
                                        <li>MP Marketing person </li>
                                    </ul>
                                </td>
                            </tr>


                        </table>
                        </tbody>


                    </div>
                </section>

                <section>
                    <div><button class="submit small" onclick="return false;"><? if (isset($user[0])) {echo 'Ažuriraj korisnika'; }else echo 'Kreiraj korisnika'; ?></button></div>
                </section> 

            </fieldset>

        </form>

    </div>


</div>

<!-- VARIABLES TO edit_new_img.js -->
<script type="text/javascript">
    var appmode;
    var get_id;
    <?  if (isset($_GET['id'])){ ?> 
        appmode = 'edit';
        get_id = '<?=$_GET['id']?>';

        <?}else{?> 
        appmode = 'insert'; 
        get_id = -1;
        <? } ?>
</script>